home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Applications / UIFlow 1.0.1 / UIFlow Source / CFDFront / TBaffle.cp < prev    next >
Encoding:
Text File  |  1992-02-21  |  2.8 KB  |  98 lines  |  [TEXT/MPS ]

  1. #pragma segment Boundry
  2. // **********************************************************************
  3. //    TBaffle Class
  4. //        The Baffle objects
  5. // **********************************************************************
  6. //    direction indicates     Vertical Baffle        (1)
  7. //                                    Horizontal Baffle    (2)
  8. // --------------------------------------------------------------------------------------------------
  9. //    TBaffle    :    Initialize the Class
  10. // --------------------------------------------------------------------------------------------------
  11. void TBaffle::IBaffle(PointInfo * info, short tDirection)
  12.     {
  13.     if (tDirection == 1)
  14.         {
  15.         fPt1 = info->above;
  16.         fPt2 = info->below;
  17.         }
  18.     else
  19.         {
  20.         fPt1 = info->left;
  21.         fPt2 = info->right;
  22.         }
  23.  
  24.     fDirection = tDirection;    
  25.     this->BaffleSet();
  26.     return;
  27.     }
  28.  
  29. // --------------------------------------------------------------------------------------------------
  30. //    TBaffle    :    Draw the baffle
  31. // --------------------------------------------------------------------------------------------------
  32. void TBaffle::Draw()
  33.     {
  34.     if (fPt1->IsBoundryPt() && fPt2->IsBoundryPt())
  35.         PenSize(gPensize_H+2,gPensize_V+2);
  36.     else
  37.         PenSize(gGridsize_H+2, gGridsize_V+2);
  38.         
  39.     HLock((Handle) this);
  40.     RGBForeColor(&BaffleColor);                                                                // set color
  41.     HUnlock((Handle) this);
  42.     PenPixPat(BafflePat);
  43.     PenMode(srcXor);                                                                                    // draw xor
  44.     MoveTo(fPt1->fTrans.h,fPt1->fTrans.v);                                                // move to this point
  45.     LineTo(fPt2->fTrans.h,fPt2->fTrans.v);                                                // draw to baffle stop
  46.     return;    
  47.     }
  48.  
  49. // --------------------------------------------------------------------------------------------------
  50. //    TBaffle    :    Release the Points
  51. // --------------------------------------------------------------------------------------------------
  52. void TBaffle::BaffleRelease(void)
  53.     {
  54.     if (fDirection == 1)
  55.         {
  56.         fPt1->SetBaffle (false,3, NULL);
  57.         fPt2->SetBaffle (false,1, NULL);
  58.         }
  59.     else
  60.         {
  61.         fPt1->SetBaffle (false,2, NULL);
  62.         fPt2->SetBaffle (false,4, NULL);
  63.         } 
  64.     }
  65.     
  66. // --------------------------------------------------------------------------------------------------
  67. //    TBaffle    :    Set the Points
  68. // --------------------------------------------------------------------------------------------------
  69. void TBaffle::BaffleSet(void)
  70.     {
  71.     if (fDirection == 1)
  72.         {
  73.         fPt1->SetBaffle (true,3, (TObject *) this);
  74.         fPt2->SetBaffle (true,1, (TObject *) this);
  75.         }
  76.     else
  77.         {
  78.         fPt1->SetBaffle (true,2, (TObject *) this);
  79.         fPt2->SetBaffle (true,4, (TObject *) this);
  80.         }
  81.     }
  82.     
  83. // --------------------------------------------------------------------------------------------------
  84. //    TBaffle    :    Release the Points
  85. // --------------------------------------------------------------------------------------------------
  86. pascal void TBaffle::Free(void)
  87.     {
  88. //    short i;
  89. //    if (fDirection == 1)
  90. //        i = 3;
  91. //    else
  92. //        i = 4;
  93. //    if (fPt1->GetBaffQuad(i) != NULL)
  94. //        this->BaffleRelease();
  95.     inherited::Free();
  96.     }
  97.     
  98.